define(["core/ModuleResolver.js" ,"Router","core/ApplicationService"],function(require, exports, module){
    var router = require("Router").public,
        service = require("core/ApplicationService"),
        moduleResolver = require("core/ModuleResolver.js"),
        bootstrap = angular.module('ApplicationBootstrap', ['ModuleResolver','ApplicationService']);

    bootstrap.config(['$locationProvider','$routeProvider', 'moduleResolverProvider', '$controllerProvider', '$compileProvider', '$filterProvider', '$provide',
        function ($locationProvider,$routeProvider, moduleResolverProvider, $controllerProvider, $compileProvider, $filterProvider, $provide) {

            var resolve = moduleResolverProvider.resolve;

            //$locationProvider.hashPrefix('!');
            $.each(router ,function(index ,route){
                //console.log(arguments);
                if(route["url"] == "otherwise"){
                    $routeProvider.otherwise({
                        redirectTo: route["redirectTo"]
                    });
                    return;
                }
                //console.log(route.options);
                $routeProvider.when(route.url,resolve(route.options));
            });

            $locationProvider.html5Mode(true);

        }]);

    bootstrap.run(['$rootScope','$location','ServicesProvider',
        function($rootScope ,$location ,servicesProvider){
            //console.log($loadOnDemandProvider);
            console.log(servicesProvider);
            var responseModel = servicesProvider.global.get(function(){
                //console.log($rootScope.config.code);
                //console.log(responseModel);
                $rootScope.config = responseModel;
            });
        }]);
    return bootstrap;
});